package chapter;

import java.io.File;

public class FileAgainTest {
	
	public long Filescount(String dir)
	{
           	long len=0;
           	
           	File filetest=new File(dir);
           	
           	
			
			
			if(filetest.length()==0)
			{
				return 0;
			}
			File[] fa=File.listRoots();
			System.out.print(fa);
			
			for(int i=0;i<filetest.length();i++)
		    {
		    	
		    	File tf[]=filetest.listFiles();
		    	
		    	
		    	
		    	if(tf[i].isFile())
		    	{
		    		len+=tf[i].length();
		    	}
			
		    	if(tf[i].isDirectory())
		    	{
		    		String s=tf[i].getAbsolutePath();
		    		len=Filescount(s);
		    		
		    	}
		    	
		    	
		    }
			return len;
			
			
           	
		
	}

	
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
